using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using System.Data.Common;
using MacomberMap.Common.Internals;
using MacomberMap.Common.User_Interfaces.Components;
using MacomberMap.Common.Types;

namespace MacomberMap.Common.Components
{
    /// <summary>
    /// This class contains information on companies (QSEs and TDSPs)
    /// </summary>
    [MM_Serializable_Target(MM_Serializable_Target.enumTargetType.Both)]
    public class MM_Company : MM_Element
    {
        #region Variable Declarations
        /// <summary>The telephone number for the QSE/TDSP</summary>
        [MM_Serializable_Target(MM_Serializable_Target.enumTargetType.TypeCollection)]
        public String PrimaryPhone;

        /// <summary>The DUNS for the company</summary>
        [MM_Serializable_Target(MM_Serializable_Target.enumTargetType.TypeCollection)]
        public String DUNS;

        /// <summary>Hide the KV level for the company</summary>
        [MM_Serializable_Target(MM_Serializable_Target.enumTargetType.None)]
        public new MM_KVLevel KVLevel = null;

        /// <summary>Hide the owner for the company</summary>
        [MM_Serializable_Target(MM_Serializable_Target.enumTargetType.None)] 
        public new MM_Company Owner = null;

        /// <summary>Hide the operator for the company</summary>
        [MM_Serializable_Target(MM_Serializable_Target.enumTargetType.None)]
        public new MM_Company Operator = null;


        /// <summary>Hide the substation for the company</summary>
        [MM_Serializable_Target(MM_Serializable_Target.enumTargetType.None)]
        public new MM_Substation Substation = null;
        #endregion

        #region Initialization
        /// <summary>
        /// Initialize a blank CIM company
        /// </summary>
        public MM_Company()
        {
            this.ElemType = MM_Overall_Display.ElemTypes["Company"]; 
        }

        /// <summary>
        /// Initialize a new CIM Transformer
        /// </summary>
        /// <param name="ElementSource">The XML source for this line</param>
        public MM_Company(XmlElement ElementSource)
            : base(ElementSource)
        { this.ElemType = MM_Overall_Display.ElemTypes["Company"]; }

        /// <summary>
        /// Initialize a new CIM Company
        /// </summary>
        /// <param name="ElementSource">The data source for this substation</param>
        public MM_Company(DbDataReader ElementSource)
            : base(ElementSource)
        {
            this.PrimaryPhone = (String)ElementSource["PrimaryPhone"];
            if (ElementSource["DUNS"] is String)
                this.DUNS = (String)ElementSource["DUNS"];

            //Make sure we have this element type
            this.ElemType = MM_Overall_Display.ElemTypes["Company"];
        }

        #endregion
    }
}